<html>
<head><meta charset="utf-8"><title>layout vector · t-lang/wg-unsafe-code-guidelines · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/index.html">t-lang/wg-unsafe-code-guidelines</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/layout.20vector.html">layout vector</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="148033885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/layout%20vector/near/148033885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/layout.20vector.html#148033885">(Nov 20 2018 at 11:47)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> i don't know what to do about the layout of unions, should I remove the unresolved question ?</p>



<a name="148035077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/layout%20vector/near/148035077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/layout.20vector.html#148035077">(Nov 20 2018 at 12:17)</a>:</h4>
<p>I'd suggest say explicitly that this is about the ABI</p>



<a name="148035078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/layout%20vector/near/148035078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/layout.20vector.html#148035078">(Nov 20 2018 at 12:17)</a>:</h4>
<p>but I think for now we dont want to make any guarantee for union ABI</p>



<a name="148035085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/layout%20vector/near/148035085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/layout.20vector.html#148035085">(Nov 20 2018 at 12:17)</a>:</h4>
<p>maybe edit unions.md as well and add the question there?</p>



<a name="148035135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/layout%20vector/near/148035135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/layout.20vector.html#148035135">(Nov 20 2018 at 12:18)</a>:</h4>
<p>seems like what we really want is <code>repr(transparent)</code> for unions, this has all the same concerns</p>



<a name="148035138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/layout%20vector/near/148035138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/layout.20vector.html#148035138">(Nov 20 2018 at 12:18)</a>:</h4>
<p>but someone should write an RFC if they want that guarantee :D</p>



<a name="148068767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/layout%20vector/near/148068767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/layout.20vector.html#148068767">(Nov 20 2018 at 21:15)</a>:</h4>
<p>Yeah, I can move the question to the union's document, using vectors in ABI as an example. Something like repr(transparent) for unions sums this up nicely.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>